﻿
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <script type="text/javascript">

        $(function () {

            InitBar(SelectorModel.SQLTemplate);
            var nodeID = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Template.Selector", nodeID);
            var paras = node.DeliveryParas;

            var sqlTemplates = new Entities("BP.WF.Template.SQLTemplates");
            sqlTemplates.RetrieveAll();
            var str = "";
            str += "&nbsp;<select id='RB_BySQLTemplate'>" + InitDDLOperation(sqlTemplates) + "</select>";

            document.getElementById("sqlTemSelect").innerHTML = str; //设置基础信息.

            //初始话下拉列表值
            if (node.SelectorModel == SelectorModel.SQLTemplate) {
                if (paras != null && paras != "")
                    $("#RB_BySQLTemplate").val(paras);
            }


        });

        //初始化下拉列表框的OPERATION
        function InitDDLOperation(sqlTemplates) {

            var operations = "";

            for (var i = 0; i < sqlTemplates.length; i++) {

                var template = sqlTemplates[i];

                if (template.No == undefined)
                    operations += "<option value='" + template.IntKey + "'>" + template.Lab + "</option>";
                else
                    operations += "<option value='" + template.No + "'>" + template.Name + "</option>";
            }
            return operations;
        }

        //装载模版.
        function OpenDialog() {
            var url = "../../../Comm/Search.htm?EnsName=BP.WF.Template.SQLTemplates&SQLType=5";
            OpenEasyUiDialogExt(url, 'SQL模板', 800, 500, false);
        }

        function Save() {
            var nodeID = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Template.Selector", nodeID);
            node.SelectorModel = SelectorModel.SQLTemplate;
            var templateNo = $("#RB_BySQLTemplate").val();
            node.DeliveryParas = templateNo;
            node.SelectorP1 = templateNo;
            node.Update();

            var node = new Entity("BP.WF.Template.NodeExt", nodeID);
            node.DeliveryWay = 4;
            node.Update();

            alert("保存成功.");
        }
    </script>
</head>
<body>

    <div id="bar"> </div>

    <fieldset>
        <legend>请选择一个SQLTemplate.</legend>
        
        <ul>
            <li>请选择一个SQLTemplate:  </li>
            <li> <label id="sqlTemSelect"> </label></li>
        </ul>
    </fieldset>


    <fieldset>
        <legend id="help">帮助</legend>
        <ul>
            <li><a href="javascript:OpenDialog();">我要配置SQLTemplate</a></li>
        </ul>
    </fieldset>
</body>
</html>
